//
//  BuyInfoTableViewCell.m
//  EasyBuy
//
//  Created by apple on 12-10-17.
//  Copyright (c) 2012年 shen donghao. All rights reserved.
//

#import "BuyInfoTableViewCell.h"
#import "EasyBuy.h"

@implementation BuyInfoTableViewCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        [self setupBuyInfo];
        
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)initCellWithBuyInfoData:(BuyInfoData *)buyInfoData{
    
    _buyID = 1;
    _userHeadPhoto = @"宝贝头像";
    _userName = @"清风吻过";
    _userType = @"淘宝用户";
    //        self.buyPhotosArray
    
   
    
//    _userHeadPhoto = [buyInfoData.userHeadPhoto retain];
//    _userName = [buyInfoData.userName retain];
//    _userType = [buyInfoData.userType retain];
////    _buyPhotosArray = [buyInfoData.bu
//    _buyTitle = [buyInfoData.buyTitle retain];
//    _buyInfoPrice = buyInfoData.buyInfoPrice;
//    _buyTime = [buyInfoData.buyTime retain];
//    _quality = [buyInfoData.quality retain];
//    _buyWay = [buyInfoData.buyWayContent retain];
//    _carriagePrice = buyInfoData.carriagePrice;
//    _address = [buyInfoData.address retain];
//    _buyInfoIntro = [buyInfoData.buyInfoIntro retain];
    
    [self buyInfoDataShow];
//    [self buyInfoDataShowWithIntro];
}

- (void)buyInfoDataShow{
    
    userHeadPhoto.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@",_userHeadPhoto]];
    userType.text = _userType;
    userName.text = _userName;
    
    
}
/*
- (void)buyInfoDataShowWithIntro{
    UIFont *font1 = [UIFont systemFontOfSize:20];
    buyTitle.lineBreakMode = UILineBreakModeWordWrap;
    buyTitle.numberOfLines = 0;
    titleSize = [_buyTitle sizeWithFont:font1 constrainedToSize:CGSizeMake(buyTitle.frame.size.width, MAXFLOAT) lineBreakMode:UILineBreakModeWordWrap];
    buyTitle.frame = CGRectMake(10, 245, 300, titleSize.height);
    buyTitle.text = _buyTitle;
    
    UIFont *font = [UIFont systemFontOfSize:20];
    buyInfoIntro.lineBreakMode = UILineBreakModeWordWrap;
    buyInfoIntro.numberOfLines = 0;
    titleSize1 = [_buyInfoIntro sizeWithFont:font constrainedToSize:CGSizeMake(buyInfoIntro.frame.size.width, MAXFLOAT) lineBreakMode:UILineBreakModeWordWrap];
    buyInfoIntro.frame = CGRectMake(15, addressContent.frame.origin.y + 35, 290, titleSize1.height);
    buyInfoIntro.text = _buyInfoIntro;
}
*/
- (void)setupBuyInfo{
    userHeadPhoto = [[UIImageView alloc] initWithFrame:CGRectMake(5, 5, 30, 30)];
    [self addSubview:userHeadPhoto];
    [userHeadPhoto release];
    
    userName = [[UILabel alloc] initWithFrame:CGRectMake(40, 7, 100, 13)];
    userName.font = [UIFont systemFontOfSize:12];
    userName.backgroundColor = [UIColor clearColor];
    [self addSubview:userName];
    [userName release];
    
    userType = [[UILabel alloc] initWithFrame:CGRectMake(40, 23, 100, 10)];
    userType.font = [UIFont systemFontOfSize:10];
    userType.backgroundColor = [UIColor clearColor];
    [self addSubview:userType];
    [userType release];
    
    UILabel *rightArrowhead  = [[UILabel alloc] initWithFrame:CGRectMake(300, 14, 9, 14)];
    rightArrowhead.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"arrow"]];
    [self addSubview:rightArrowhead];
    [rightArrowhead release];
    
    
    
    UILabel *buyInfoline = [[UILabel alloc]initWithFrame:CGRectMake(5,40, 310, 2)];
    buyInfoline.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"buyInfo_line"]];
    [self addSubview:buyInfoline];
    [buyInfoline release];
    
        
    
}



- (void)dealloc {

    [super dealloc];
}
@end
